const { Page } = require('./VirtualWx')

const { sop } = require('./so')
const { xState } = require('./state')
const [x, setX] = xState

function initLog() {
    Page(sop({
        name: 'log',
        data: {
            aa: 1,
            cc: 10,
        },
        onReady: function() {
            console.log('before', this.data)
            this.setData({
                aa: 2,
                bb: 3,
            })
            console.log(x())
            setX(20)
            console.log('after', this.data)
            for (let i=0;i<10;i++) {
                this.setData({
                    aa: i,
                })
            }
        },
        onAction: function() {
            console.log(x())
        }
    }))
}

module.exports = {
    initLog,
}
